<script setup lang="ts">

// 对象形式声明 key value
const props = defineProps({
	current: {
		type: Number,
		default: 1
	},

	total: {
		type: Number,
		default: 1
	},
})

let emitFn = defineEmits(['on-Page'])


const prePage = () => {
	if (props.current > 1) {
		emitFn('on-Page', props.current - 1)
	}
}
const nextPage = () => {
	if (props.current < props.total) {
		emitFn('on-Page', props.current + 1)
	}
	console.log(props.total);
	
}

</script>
    
<template>
	<view class="footer">
		<view class="left box" @click="prePage">上一题</view>
		<view class="right box" @click="nextPage" v-if="props.current != props.total">下一题</view>
		<view class="right box" v-else>提交</view>

	</view>
</template>
    
<style scoped lang="scss">
.footer {
	position: fixed;
	bottom: 0;
	width: 100%;
	height: 100rpx;
	// background-color: red;
	@include flex();
	// border: 1px solid $bgcolor;

	.box {
		flex: 1;
		@include flex();
		height: 100%;
		// background-color: aqua;
	}

	.left {
		color: $bgcolor;
		background-color: #fff;
		background-color: #e5eefd;
	}

	.right {
		color: #fff;
		background-color: $bgcolor;
	}

}
</style>